import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jiang Jinxi
 * Date: 2024-03-09
 * Time: 15:26
 */
public class Point {
    public static void main(String[] args) {
        System.out.print("Enter x1,y1,x2,y2,x3,y3,x4,y4:");
        double[] point = new double[8];
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < point.length; i++) {
            point[i] = scanner.nextDouble();
        }
        double a = point[1] - point[3];
        double b = point[2] - point[0];
        double e = a * point[0] + b * point[1];
        double c = point[5] - point[7];
        double d = point[6] - point[4];
        double f = c * point[4] + d * point[5];
        if(a*d - b*c == 0 ){
            System.out.println("The two lines are parallel");
        }else{
            double x = (e*d - b*f)/(a*d - b*c);
            double y = (a*f - e*c)/(a*d - b*c);
            System.out.println("The intersecting is at (" + String.format("%.5f",x) + ", " + String.format("%.5f",y) + ")");
        }
    }
}
